package com.chunlei.check.config;

import com.chunlei.check.interceptor.ApiIdempotentInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/11/9 19:45
 */
@Configuration
public class WebFilterConfig extends WebMvcConfigurationSupport
{
    @Override
    protected void addInterceptors(InterceptorRegistry registry)
    {
        registry.addInterceptor(apiIdempotentInterceptor());
        super.addInterceptors(registry);
    }

    @Bean
    public ApiIdempotentInterceptor apiIdempotentInterceptor() {
        return new ApiIdempotentInterceptor();
    }
}
